import tkinter as tk

def button_click():
    print("按钮被点击了")

root = tk.Tk()
root.title("带有按钮的窗口")
# 创建一个按钮，文本为"点击我"，点击按钮时调用button_click函数
button = tk.Button(root, text="点击我", command=button_click)
button.pack()
root.mainloop()